package com.yang.jxj;

import com.yang.jxj.entity.Students;
import com.yang.jxj.entity.Teachers;

import com.yang.jxj.service.impl.StudentsServiceImpl;
import com.yang.jxj.service.impl.TeachersServiceImpl;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class UserDtotest {
    @Autowired
    private StudentsServiceImpl studentsServiceImpl;
    @Autowired
    private TeachersServiceImpl teachersServiceImpl;
    @Test
    public void InsertTest() {
        Students student = new Students();
        student.setStudentId(2022000015);
        student.setName("马大炮");
        student.setEnrollmentYear(2023);
        student.setDepartment("网络");
        student.setGrade("研一");
        studentsServiceImpl.save(student);
    }
    @Test
    public void TInsertTest() {
        Teachers teacher = new Teachers();
        teacher.setTeacherId(1022081007);
        teacher.setAge(32);
        teacher.setName("李勇");
        teachersServiceImpl.save(teacher);
    }

    @Test
    public void DeleteTest() {
        boolean b = studentsServiceImpl.removeById(2022000003);
        System.out.println(b);
    }
    @Test
    public void    TDeleteTest() {
        teachersServiceImpl.removeById(1022081007);

    }
    @Test
    public void UpdateTest() {

        List<Students> list = studentsServiceImpl.list();
        System.out.println(list);
    }


}
